home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17188 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: news.cyberport.com!usenet
  2. From: tangent@cyberport.com (Warren Young)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: The STL and nested structures
  5. Date: Sun, 14 Apr 1996 09:02:59 GMT
  6. Organization: none
  7. Message-ID: <3170bdd7.308224233@news.cyberport.com>
  8. References: <4ju9q7$fa1$1@mhadg.production.compuserve.com> <316a26d7.2989288@news.cyberport.com> <marnoldDpn0HH.3z2@netcom.com>
  9. NNTP-Posting-Host: ppp4.cyberport.com
  10. X-Newsreader: Forte Agent .99d/32.182
  11.  
  12. marnold@netcom.com (Matt Arnold) wrote:
  13.  
  14. >>>I am having a problem using the STL with structures defined within 
  15. >>>a class definition.  Consider the following code fragment.
  16. >>>...
  17. >>>The compiler I am using (VC 4.1) refuses to compile.  An error is 
  18. >>>generated the says "'Foo' : undeclared identifier" at line 75 in 
  19. >>>vector.h.
  20. >
  21. >>It _is_ undeclared, just as a variable local to a function foo() is
  22. >>undeclared in a function bar().  What you want to say is:
  23. >
  24. >This should not be necessary.  Nested class Foo should be visible for
  25. >use in template member Bar::fooContainer.  fooContainer is in Bar's
  26. >scope.  There should be no problem referring to it within Bar.  
  27.  
  28. Yep, you're right.  I didn't look at the code carefully enough.
  29.  
  30. >I think Visual C++ is broken on the above code.  It compiles fine in 
  31. >Borland C++.
  32.  
  33. Once again, I'm pulled back from the MS abyss...
  34.  
  35. >>Even this won't work until Foo is placed in the public section of the
  36. >>class (as shown above, it's in the private (default) section).
  37. >
  38. >That requirement would make private nested implementation class'
  39. >impossible, wouldn't it?
  40.  
  41. Assuming he was declaring the vector outside the class's scope, I was
  42. right.  Once you get the straight dope on that, and the rest of the
  43. post is rubbish.  It all depended on that one premise.
  44.  
  45. >Is it true that STL is currently incorrectly implemented?
  46.  
  47. By who, and in what regard?  I hadn't heard anything of this.  Unless
  48. of course you count the hacks necessary to get STL to compile on the
  49. current state of the art compilers.  For example, I don't know of any
  50. "popular" C++ compilers that support default template parameters
  51. (maybe BC++ 5.0 does now...).  Many things in STL require this (map
  52. for instance) but they're being faked with some preprocessor trickery.
  53.  
  54.  
  55. I haven't actually vgrepped the code for this sort of thing, though,
  56. so I'm not sure of the details.
  57.  
  58. = Warren --
  59.